package day04;
import java.util.Scanner;
import java.util.Random;
public class HomeWork {
    public static void main(String[] args) {
        //1. Guessing猜数字之while版：

        //要求：随机生成一个数，由用户来猜，猜不对则反复猜，并给出大小提示，猜对的则结束，用while来实现。
        Scanner scan = new Scanner(System.in);
        Random random=new Random();
        int num= random.nextInt(1000)+1;
        int guess= scan.nextInt();
        while(guess!=num) {
            if (guess > num) {
                System.out.println("猜数大了，请重新输入：");
            }
            if(guess<num){System.out.println("猜数小了，请重新输入：");}
            guess= scan.nextInt();
        }
        System.out.println("猜对了！你真棒！！！");
        scan.close();

        Scanner scan1 = new Scanner(System.in);
        Random random1=new Random();
        int num1= random1.nextInt(563)+1;
        int guess1= scan1.nextInt();
        while(guess1!=num1) {
            if(guess1>num1){
                System.out.println("猜数大了，请重新输入：");
            }
            if(guess1<num1){
                System.out.println("猜数小了，请重新输入：");
            }
            guess1 = scan1.nextInt();
        }
        System.out.println("great！你猜对了！！！！");
        scan1.close();

        //2. for循环：输出5次"行动是成功的阶梯"、输出9的乘法表(1到9、1/3/5/7/9)、累加1到100的和

        for(int i1=1;i1<=5;i1++){
            System.out.println("行动是成功的阶梯");
        }

        for(int i1=1;i1<=5;i1++){
            System.out.println("行动是成功的阶梯");
        }


        for(int a=1;a<=9;a++){
            System.out.println(a+"*9="+a*9);
        }

        for(int a1=1;a1<=9;a1++){
            System.out.println(a1+"*9="+a1*9);
        }

        for(int c=1;c<=9;c+=2){
            System.out.println(c+"*9="+c*9);
        }

        for(int c1=1;c1<=9;c1+=2){
            System.out.println(c1+"*9="+c1*9);
        }
        // 3. MultiTable九九乘法表

        for(int d=1;d<=9;d++){
            for(int e=1;e<=d;e++){
                System.out.println(d+"*"+e+"="+e*d);
            }
        }
        for(int d1=9;d1>=1;d1--){
            for(int e1=1;e1<=d1;e1++){
                System.out.println(d1+"*"+e1+"="+d1*e1);
            }
        }
        //要求：输出九九乘法表

        //4. 数组小代码练习：声明、初始化
        int[]w= new int[23];
        double[]e=new double[23];
        short[]f=new short[45];
        int[]w1={2,3,4};
        double[]e1={45,67,89};
        short[]f1={67,45,54};

        int[]r=new int[54];
        double[]s=new double[67];
        short[]t=new short[56];
        int[]r1={34,56,23};
        double[]s1=new double[45];
        s1=new double[]{23.3,3433.2,4.2};
        short[]t1=new short[4];
        t1=new short[]{34,56,32};


    }
}
